<!--?xml version="1.0" encoding="iso-8859-1"?-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><script src="ppdoc_files/menu134.js" type="text/javascript"></script><link media="all" href="ppdoc_files/widget100.css" type="text/css" rel="stylesheet">
<title>Parallel Python - Parallel Python documentation</title>
<meta name="title" content="Parallel Python documentation">
<meta name="author" content="Administrator">
<meta name="description" content="Parallel Python">
<meta name="keywords" content="parallel python">
<meta name="Generator" content="Joomla! - Copyright (C) 2005 - 2006 Open Source Matters. All rights reserved.">
<meta name="robots" content="index, follow">
<script async="" src="ppdoc_files/cbgapi.loaded_0"></script><script language="JavaScript" type="text/javascript" src="ppdoc_files/script.js"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
			var smf_theme_url = "http://www.parallelpython.com/forum/Themes/default";
			var smf_images_url = "http://www.parallelpython.com/forum/Themes/default/images";
			var smf_scripturl = "http://www.parallelpython.com/component/option,com_smf/Itemid,28/";
			var smf_session_id = "ab2f004fcfef43bc462ad40586336fe3";
			// ]]></script>
<link rel="help" href="http://www.parallelpython.com/component/option,com_smf/Itemid,28/action,help/" target="_blank">
<link rel="search" href="http://www.parallelpython.com/component/option,com_smf/Itemid,28/action,search/">
<link rel="contents" href="http://www.parallelpython.com/component/option,com_smf/Itemid,28/">
<link rel="alternate" type="application/rss+xml" title="Parallel Python Community Forums - RSS" href="http://www.parallelpython.com/component/option,com_smf/Itemid,28/type,rss;action,.xml/">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
			<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[ 
			var current_header = false; 
 
          function shrinkHeader(mode) 
          { document.cookie = "upshrink=" + (mode ? 1 : 0);   document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif"); 
 
               document.getElementById("upshrinkHeader").style.display = mode ? "none" : ""; 
               document.getElementById("upshrinkHeader2").style.display = mode ? "none" : ""; 
 
               current_header = mode; 
				} 
				// ]]></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[ 
               var current_header_ic = false; 
 
               function shrinkHeaderIC(mode) 
               {
document.cookie = "upshrinkIC=" + (mode ? 1 : 0);
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif"); 
 
                    document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : ""; 
 
                    current_header_ic = mode; 
               } 
          // ]]></script>
<!-- base href="http://www.parallelpython.com/" -->
	<link rel="shortcut icon" href="http://www.parallelpython.com/images/favicon.ico">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="netinsert" content="0.0.1.3.4.8.1">
<link href="ppdoc_files/template_css.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="http://www.parallelpython.com/images/favicon.ico">
<div id="_atssh" style="visibility: hidden; height: 1px; width: 1px; position: absolute; z-index: 100000;"><iframe src="ppdoc_files/sh105.htm" style="height: 1px; width: 1px; position: absolute; z-index: 100000; border: 0px none; left: 0px; top: 0px;" title="AddThis utility frame" id="_atssh268"></iframe></div><script src="ppdoc_files/core053.js" type="text/javascript"></script></head>
<body>
<div id="outer" class="outer">
	<div class="section1">
		<div class="sitename">Parallel Python</div>
		<div class="sitedate">
    	</div>
		<div id="pathway_outer" class="pathway_outer">
			<div id="pathway" class="pathway" style="float:left;width:50%;"><span class="pathway"><a href="http://www.parallelpython.com/" class="pathway">Home</a> <img src="ppdoc_files/arrow.png" alt="arrow">   Documents </span></div>
            <div style="float:right;"><div id="___plusone_0" style="height: 15px; width: 24px; display: inline-block; text-indent: 0px; margin: 0px; padding: 0px; background: none repeat scroll 0% 0% transparent; border-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline;"><iframe title="+1" allowtransparency="true" src="ppdoc_files/fastbutton.htm" name="I0_1356074737799" id="I0_1356074737799" vspace="0" tabindex="0" style="position: static; top: 0px; width: 24px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 15px;" marginwidth="0" marginheight="0" hspace="0" frameborder="0" scrolling="no" width="100%"></iframe></div></div>
            <div class="addthis_toolbox addthis_default_style" style="float: right; display: inline-block; text-align: right;">
            <nobr>
            <a href="#" title="Facebook" class="addthis_button_preferred_1 addthis_button_facebook at300b"><span class="at16nc at300bs at15nc at15t_facebook at16t_facebook"><span class="at_a11y">Share on facebook</span></span></a>
            <a href="#" title="Tweet" class="addthis_button_preferred_2 addthis_button_twitter at300b"><span class="at16nc at300bs at15nc at15t_twitter at16t_twitter"><span class="at_a11y">Share on twitter</span></span></a>
            <a href="#" title="Email" class="addthis_button_preferred_3 addthis_button_email at300b"><span class="at16nc at300bs at15nc at15t_email at16t_email"><span class="at_a11y">Share on email</span></span></a>
            <a href="#" title="Print" class="addthis_button_preferred_4 addthis_button_print at300b"><span class="at16nc at300bs at15nc at15t_print at16t_print"><span class="at_a11y">Share on print</span></span></a>
            <a title="Gmail" target="_blank" href="http://www.addthis.com/bookmark.php?v=250&amp;winname=addthis&amp;pub=linkedweb&amp;source=tbx-250&amp;lng=en&amp;s=gmail&amp;url=http%3A%2F%2Fwww.parallelpython.com%2Fcontent%2Fview%2F15%2F30%2F&amp;title=Parallel%20Python%20-%20Parallel%20Python%20documentation&amp;ate=AT-linkedweb/-/-/50d40ef19ba24535/2/50d408bbf29cdd2c&amp;frommenu=1&amp;uid=50d408bbf29cdd2c&amp;ct=1&amp;tt=0&amp;captcha_provider=nucaptcha" class="addthis_button_preferred_5 addthis_button_gmail at300b"><span class="at16nc at300bs at15nc at15t_gmail at16t_gmail"><span class="at_a11y">Share on gmail</span></span></a>
            <a title="StumbleUpon" target="_blank" href="http://www.addthis.com/bookmark.php?v=250&amp;winname=addthis&amp;pub=linkedweb&amp;source=tbx-250&amp;lng=en&amp;s=stumbleupon&amp;url=http%3A%2F%2Fwww.parallelpython.com%2Fcontent%2Fview%2F15%2F30%2F&amp;title=Parallel%20Python%20-%20Parallel%20Python%20documentation&amp;ate=AT-linkedweb/-/-/50d40ef19ba24535/3/50d408bbf29cdd2c&amp;frommenu=1&amp;uid=50d408bbf29cdd2c&amp;ct=1&amp;tt=0&amp;captcha_provider=nucaptcha" class="addthis_button_preferred_6 addthis_button_stumbleupon at300b"><span class="at16nc at300bs at15nc at15t_stumbleupon at16t_stumbleupon"><span class="at_a11y">Share on stumbleupon</span></span></a>
            <a href="#" title="Favorites" class="addthis_button_preferred_7 addthis_button_favorites at300b"><span class="at16nc at300bs at15nc at15t_favorites at16t_favorites"><span class="at_a11y">Share on favorites</span></span></a>
            <a title="Blogger" target="_blank" href="http://www.addthis.com/bookmark.php?v=250&amp;winname=addthis&amp;pub=linkedweb&amp;source=tbx-250&amp;lng=en&amp;s=blogger&amp;url=http%3A%2F%2Fwww.parallelpython.com%2Fcontent%2Fview%2F15%2F30%2F&amp;title=Parallel%20Python%20-%20Parallel%20Python%20documentation&amp;ate=AT-linkedweb/-/-/50d40ef19ba24535/4/50d408bbf29cdd2c&amp;frommenu=1&amp;uid=50d408bbf29cdd2c&amp;ct=1&amp;tt=0&amp;captcha_provider=nucaptcha" class="addthis_button_preferred_8 addthis_button_blogger at300b"><span class="at16nc at300bs at15nc at15t_blogger at16t_blogger"><span class="at_a11y">Share on blogger</span></span></a>
            <a href="#" class="addthis_button_compact at300m"><span class="at16nc at300bs at15nc at15t_compact at16t_compact"><span class="at_a11y">More Sharing Services</span></span></a>    
            </nobr>
            <div class="atclear"></div></div>
        <script type="text/javascript">
        var addthis_config = {
            pubid: 'linkedweb',
        };
        </script>
        <script type="text/javascript" src="ppdoc_files/addthis_widget.js" async=""></script>
        <script gapi_processed="true" type="text/javascript" src="ppdoc_files/plusone.js" async=""></script>  
		</div>
	</div>
	<div class="section2">
					<div id="user3" class="user3">
						<table class="moduletable" cellpadding="0" cellspacing="0">
				<tbody><tr>
			<td>
				<ul id="mainlevel-nav"><li><a href="http://www.parallelpython.com/" class="mainlevel-nav">Home</a></li><li><a href="http://www.parallelpython.com/component/option,com_smf/Itemid,29/" class="mainlevel-nav">Forums</a></li><li><a href="http://www.parallelpython.com/content/view/15/30/" class="mainlevel-nav" id="active_menu-nav">Documents</a></li><li><a href="http://www.parallelpython.com/content/view/17/31/" class="mainlevel-nav">Examples</a></li><li><a href="http://www.parallelpython.com/component/option,com_smf/Itemid,29/topic,210.msg653#msg653" class="mainlevel-nav">FAQ</a></li><li><a href="http://www.parallelpython.com/content/view/18/32/" class="mainlevel-nav">Downloads</a></li><li><a href="http://www.parallelpython.com/component/option,com_weblinks/Itemid,23/" class="mainlevel-nav">Links</a></li><li><a href="http://www.pythonblogs.com/" class="mainlevel-nav">Blogs</a></li><li><a href="http://www.parallelpython.com/component/option,com_contact/Itemid,3/" class="mainlevel-nav">Contact Us</a></li></ul>			</td>
		</tr>
		</tbody></table>
					</div>
				<!--commented by Vitalii div class="logo"><img src="http://www.parallelpython.com/templates/vivacious14/images/logo.gif" alt="Free Mambo Templates TY2U.com"></div-->
				<div class="topspace">
					<table class="moduletable" cellpadding="0" cellspacing="0">
				<tbody><tr>
			<td>
				<a href="http://www.structuredjournal.com/"><img src="ppdoc_files/sj_banner.png" alt="Nutrition facts and analysis" title="Structured journal" style="border:0"></a>			</td>
		</tr>
		</tbody></table>
				</div>
			</div>
	<div class="section3">
		<!--div class="search_outer">
		  <div class="search_inner">
				<form action="index.php" method="post">
				  <input class="inputbox" type="text" name="searchword" size="15" tabindex="1" value="search..."  onblur="if(this.value=='') this.value='search...';" onfocus="if(this.value=='search...') this.value='';" />
					<br /><input name="submit" type="image" src="http://www.parallelpython.com/templates/vivacious14/images/search.gif" class="searchbutton" tabindex="2" value="Search"/>			  		<div class="advsearch"><a href="/index.php?option=com_search">Advanced Search</a></div>
				  <input type="hidden" name="option" value="search" />
				</form>
			</div>
		</div-->
			</div>
		<div class="section5">
			</div>
	<div class="section6">

		<div class="mainbody">
						<table class="contentpaneopen">
			<tbody><tr>
								<td class="contentheading" width="100%">
					Parallel Python documentation									</td>
							<td class="buttonheading" align="right" width="100%">
				<a href="http://www.parallelpython.com/index2.php?option=com_content&amp;do_pdf=1&amp;id=15" target="_blank" onclick="window.open('http://www.parallelpython.com/index2.php?option=com_content&amp;do_pdf=1&amp;id=15','win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'); return false;" title="PDF">
					<img src="ppdoc_files/pdf_button.png" alt="PDF" name="PDF" align="middle" border="0"></a>
			</td>
							<td class="buttonheading" align="right" width="100%">
					<a href="http://www.parallelpython.com/index2.php?option=com_content&amp;task=view&amp;id=15&amp;pop=1&amp;page=0&amp;Itemid=30" target="_blank" onclick="window.open('http://www.parallelpython.com/index2.php?option=com_content&amp;task=view&amp;id=15&amp;pop=1&amp;page=0&amp;Itemid=30','win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'); return false;" title="Print">
						<img src="ppdoc_files/printButton.png" alt="Print" name="Print" align="middle" border="0"></a>
				</td>
							<td class="buttonheading" align="right" width="100%">
				<a href="http://www.parallelpython.com/index2.php?option=com_content&amp;task=emailform&amp;id=15&amp;itemid=30" target="_blank" onclick="window.open('http://www.parallelpython.com/index2.php?option=com_content&amp;task=emailform&amp;id=15&amp;itemid=30','win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=400,height=250,directories=no,location=no'); return false;" title="E-mail">
					<img src="ppdoc_files/emailButton.png" alt="E-mail" name="E-mail" align="middle" border="0"></a>
			</td>
						</tr>
			</tbody></table>
			
		<table class="contentpaneopen">
				<tbody><tr>
			<td colspan="2" valign="top">
				<p>&nbsp;<a href="http://www.parallelpython.com/content/view/15/30/#API">Module API</a> <br>&nbsp;<a href="http://www.parallelpython.com/content/view/15/30/#QUICKSMP">Quick start guide, SMP</a><br>&nbsp;<a href="http://www.parallelpython.com/content/view/15/30/#QUICKCLUSTERS">Quick start guide, clusters<br>&nbsp;</a><a href="http://www.parallelpython.com/content/view/15/30/#QUICKCLUSTERSAUTO">Quick start guide, clusters with auto-discovery</a><br> &nbsp;<a href="http://www.parallelpython.com/content/view/15/30/#ADVANCEDCLUSTERS">Advanced guide, clusters</a><br> &nbsp;<a href="http://www.parallelpython.com/content/view/15/30/#COMMANDLINE">Command line arguments, ppserver.py</a><br>&nbsp;<a href="http://www.parallelpython.com/content/view/15/30/#SECURITY">Security and secret key</a><br>&nbsp;<a href="http://www.parallelpython.com/component/option,com_smf/Itemid,29/topic,210.msg653#msg653" title="PP FAQ">PP FAQ</a> </p><hr> <p>&nbsp;</p><h1 id="API">&nbsp; pp 1.6.3 module API</h1>   <p> </p><table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%"> <tbody><tr bgcolor="#ffc8d8"> <td colspan="3" valign="bottom">&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="Server" title="Server"></a>class <strong>Server</strong></font></td></tr>      <tr bgcolor="#ffc8d8"><td rowspan="2">&nbsp;&nbsp;&nbsp;</td> <td colspan="2">Parallel&nbsp;Python&nbsp;SMP&nbsp;execution&nbsp;server&nbsp;class<br>&nbsp;</td></tr> <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br>  <dl><dt><a name="Server-__init__" title="Server-__init__"></a><strong>__init__</strong>(self, ncpus<font color="#909090">='autodetect'</font>, ppservers<font color="#909090">=()</font>, secret<font color="#909090">=None</font>, restart<font color="#909090">=False</font>, proto<font color="#909090">=2</font>, socket_timeout<font color="#909090">=3600</font>)</dt><dd>Creates&nbsp;<a href="http://www.parallelpython.com/content/view/15/30/#Server">Server</a>&nbsp;instance<br>  &nbsp;</dd><dd>&nbsp;</dd><dd>&nbsp;</dd><dd> ncpus&nbsp;-&nbsp;the&nbsp;number&nbsp;of&nbsp;worker&nbsp;processes&nbsp;to&nbsp;start&nbsp;on&nbsp;the&nbsp;local&nbsp;<br>
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;computer,&nbsp;if&nbsp;parameter&nbsp;is&nbsp;omitted&nbsp;it&nbsp;will&nbsp;be&nbsp;set&nbsp;to&nbsp;<br>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system<br> ppservers&nbsp;-&nbsp;list&nbsp;of&nbsp;active&nbsp;parallel&nbsp;python&nbsp;execution&nbsp;servers&nbsp;<br>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;connect&nbsp;with<br> secret&nbsp;-&nbsp;passphrase&nbsp;for&nbsp;network&nbsp;connections,&nbsp;if&nbsp;omitted&nbsp;a&nbsp;default<br>
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;passphrase&nbsp;will&nbsp;be&nbsp;used.&nbsp;It's&nbsp;highly&nbsp;recommended&nbsp;to&nbsp;use&nbsp;a&nbsp;<br>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;custom&nbsp;passphrase&nbsp;for&nbsp;all&nbsp;network&nbsp;connections.<br></dd><dd>restart&nbsp;- whether to&nbsp;restart&nbsp;worker&nbsp;process&nbsp;after&nbsp;each&nbsp;task&nbsp;completion&nbsp;<br> proto&nbsp;-&nbsp;protocol&nbsp;number&nbsp;for&nbsp;pickle&nbsp;module</dd><dd>socket_timeout - socket timeout in seconds which is also the maximum <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; time a remote job could be executed. Increase this value<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if you have long running jobs or decrease if connectivity<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to remote ppservers is often lost. <br></dd><dd>&nbsp;  <br> With&nbsp;ncpus&nbsp;=&nbsp;1&nbsp;all&nbsp;tasks&nbsp;are&nbsp;executed&nbsp;consequently<br> For&nbsp;the&nbsp;best&nbsp;performance&nbsp;either&nbsp;use&nbsp;the&nbsp;default&nbsp;"autodetect"&nbsp;value<br>  or&nbsp;set&nbsp;ncpus&nbsp;to&nbsp;the&nbsp;total&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system</dd></dl><dl><dt><a name="Server-destroy" title="Server-destroy"></a><strong>destroy</strong>(self)</dt><dd>Kills&nbsp;ppworkers&nbsp;and&nbsp;closes&nbsp;open&nbsp;files</dd></dl>  <dl><dt><a name="Server-get_active_nodes" title="Server-get_active_nodes"></a><strong>get_active_nodes</strong>(self)</dt><dd>Returns&nbsp;active&nbsp;nodes&nbsp;as&nbsp;a&nbsp;dictionary&nbsp;<br>  [keys&nbsp;-&nbsp;nodes,&nbsp;values&nbsp;-&nbsp;ncpus]</dd></dl>  <dl><dt><a name="Server-get_ncpus" title="Server-get_ncpus"></a><strong>get_ncpus</strong>(self)</dt><dd>Returns&nbsp;the&nbsp;number&nbsp;of&nbsp;local&nbsp;worker&nbsp;processes&nbsp;(ppworkers)</dd></dl>  <dl><dt><a name="Server-get_stats" title="Server-get_stats"></a><strong>get_stats</strong>(self)</dt><dd>Returns&nbsp;job&nbsp;execution&nbsp;statistics&nbsp;as&nbsp;a&nbsp;dictionary</dd></dl><dl><dt><a name="Server-print_stats" title="Server-print_stats"></a><strong>print_stats</strong>(self)</dt><dd>Prints&nbsp;job&nbsp;execution&nbsp;statistics.&nbsp;Useful&nbsp;for&nbsp;benchmarking&nbsp;on&nbsp;<br>  clusters</dd></dl>  <dl><dt><a name="Server-set_ncpus" title="Server-set_ncpus"></a><strong>set_ncpus</strong>(self, ncpus<font color="#909090">='autodetect'</font>)</dt><dd>Sets&nbsp;the&nbsp;number&nbsp;of&nbsp;local&nbsp;worker&nbsp;processes&nbsp;(ppworkers)<br> &nbsp;<br>  ncpus&nbsp;-&nbsp;the&nbsp;number&nbsp;of&nbsp;worker&nbsp;processes,&nbsp;if&nbsp;parammeter&nbsp;is&nbsp;omitted<br>
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it&nbsp;will&nbsp;be&nbsp;set&nbsp;to&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system</dd></dl>  <dl><dt><a name="Server-submit" title="Server-submit"></a><strong>submit</strong>(self, func, args<font color="#909090">=()</font>, depfuncs<font color="#909090">=()</font>, modules<font color="#909090">=()</font>, callback<font color="#909090">=None</font>, callbackargs<font color="#909090">=()</font>, group<font color="#909090">='default'</font>, globals<font color="#909090">=None</font>)</dt><dd>Submits&nbsp;function&nbsp;to&nbsp;the&nbsp;execution&nbsp;queue<br>  &nbsp;<br> func&nbsp;-&nbsp;function&nbsp;to&nbsp;be&nbsp;executed<br> args&nbsp;-&nbsp;tuple&nbsp;with&nbsp;arguments&nbsp;of&nbsp;the&nbsp;'func'<br>  depfuncs&nbsp;-&nbsp;tuple&nbsp;with&nbsp;functions&nbsp;which&nbsp;might&nbsp;be&nbsp;called&nbsp;from&nbsp;'func'<br> modules&nbsp;-&nbsp;tuple&nbsp;with&nbsp;module&nbsp;names&nbsp;to&nbsp;import<br>  callback&nbsp;-&nbsp;callback&nbsp;function&nbsp;which&nbsp;will&nbsp;be&nbsp;called&nbsp;with&nbsp;argument&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list&nbsp;equal&nbsp;to&nbsp;callbackargs+(result,)&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as&nbsp;soon&nbsp;as&nbsp;calculation&nbsp;is&nbsp;done<br>  callbackargs&nbsp;-&nbsp;additional&nbsp;arguments&nbsp;for&nbsp;callback&nbsp;function<br> group&nbsp;-&nbsp;job&nbsp;group,&nbsp;is&nbsp;used&nbsp;when&nbsp;<a href="http://www.parallelpython.com/content/view/15/30/#Server-wait">wait</a>(group)&nbsp;is&nbsp;called&nbsp;to&nbsp;wait&nbsp;for<br>  jobs&nbsp;in&nbsp;a&nbsp;given&nbsp;group&nbsp;to&nbsp;finish<br> globals&nbsp;-&nbsp;dictionary&nbsp;from&nbsp;which&nbsp;all&nbsp;modules,&nbsp;functions&nbsp;and&nbsp;classes<br>  will&nbsp;be&nbsp;imported,&nbsp;for&nbsp;instance:&nbsp;globals=globals()</dd></dl>  <dl><dt><a name="Server-wait" title="Server-wait"></a><strong>wait</strong>(self, group<font color="#909090">=None</font>)</dt><dd>Waits&nbsp;for&nbsp;all&nbsp;jobs&nbsp;in&nbsp;a&nbsp;given&nbsp;group&nbsp;to&nbsp;finish.<br>  If&nbsp;group&nbsp;is&nbsp;omitted&nbsp;waits&nbsp;for&nbsp;all&nbsp;jobs&nbsp;to&nbsp;finish</dd></dl>  <dl><dt><strong>default_port</strong> = 60000</dt></dl>  <dl><dt><strong>default_secret</strong> = 'epo20pdosl;dksldkmm'</dt></dl>  </td></tr></tbody></table> <p></p><p> </p><table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%"> <tbody><tr bgcolor="#ffc8d8"> <td colspan="3" valign="bottom">&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="Template" title="Template"></a>class <strong>Template</strong></font></td></tr>      <tr bgcolor="#ffc8d8"><td rowspan="2">&nbsp;&nbsp;&nbsp;</td> <td colspan="2"><a href="http://www.parallelpython.com/content/view/15/30/#Template">Template</a>&nbsp;class<br>&nbsp;</td></tr>  <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Template-__init__" title="Template-__init__"></a><strong>__init__</strong>(self, job_server, func, depfuncs<font color="#909090">=()</font>, modules<font color="#909090">=()</font>, callback<font color="#909090">=None</font>, callbackargs<font color="#909090">=()</font>, group<font color="#909090">='default'</font>, globals<font color="#909090">=None</font>)</dt><dd>Creates&nbsp;<a href="http://www.parallelpython.com/content/view/15/30/#Template">Template</a>&nbsp;instance<br>  &nbsp;<br> jobs_server&nbsp;-&nbsp;pp&nbsp;server&nbsp;for&nbsp;submitting&nbsp;jobs<br> func&nbsp;-&nbsp;function&nbsp;to&nbsp;be&nbsp;executed<br> depfuncs&nbsp;-&nbsp;tuple&nbsp;with&nbsp;functions&nbsp;which&nbsp;might&nbsp;be&nbsp;called&nbsp;from&nbsp;'func'<br>  modules&nbsp;-&nbsp;tuple&nbsp;with&nbsp;module&nbsp;names&nbsp;to&nbsp;import<br> callback&nbsp;-&nbsp;callback&nbsp;function&nbsp;which&nbsp;will&nbsp;be&nbsp;called&nbsp;with&nbsp;argument&nbsp;<br>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list&nbsp;equal&nbsp;to&nbsp;callbackargs+(result,)&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as&nbsp;soon&nbsp;as&nbsp;calculation&nbsp;is&nbsp;done<br> callbackargs&nbsp;-&nbsp;additional&nbsp;arguments&nbsp;for&nbsp;callback&nbsp;function<br>  group&nbsp;-&nbsp;job&nbsp;group,&nbsp;is&nbsp;used&nbsp;when&nbsp;wait(group)&nbsp;is&nbsp;called&nbsp;to&nbsp;wait&nbsp;for<br> jobs&nbsp;in&nbsp;a&nbsp;given&nbsp;group&nbsp;to&nbsp;finish<br>  globals&nbsp;-&nbsp;dictionary&nbsp;from&nbsp;which&nbsp;all&nbsp;modules,&nbsp;functions&nbsp;and&nbsp;classes<br> will&nbsp;be&nbsp;imported,&nbsp;for&nbsp;instance:&nbsp;globals=globals()</dd></dl>  <dl><dt><a name="Template-submit" title="Template-submit"></a><strong>submit</strong>(self, *args)</dt><dd>Submits&nbsp;function&nbsp;with&nbsp;*arg&nbsp;arguments&nbsp;to&nbsp;the&nbsp;execution&nbsp;queue</dd></dl>   </td></tr></tbody></table><p></p><p> </p><table summary="section" border="0" cellpadding="2" cellspacing="0" width="100%">  <tbody><tr bgcolor="#55aa55"> <td colspan="3" valign="bottom">&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><strong>Data</strong></font></td></tr>      <tr><td bgcolor="#55aa55">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;</td> <td width="100%"><strong>copyright</strong> = 'Copyright (c) 2005-2012 Vitalii Vanovschi. All rights reserved'<br> <strong>version</strong> = '1.6.3'</td></tr></tbody></table>      <p></p><hr><h1 id="QUICKSMP">&nbsp; Quick start guide, SMP<br></h1> <p>1) Import pp module:</p><p><strong>&nbsp;&nbsp;&nbsp; import pp</strong></p><p>2)
 Start pp execution server with the number of workers set 
to&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system
 </p><p><strong>&nbsp;&nbsp;&nbsp; job_server = pp.Server()&nbsp;</strong></p><p>3) Submit all the tasks for parallel execution:</p><p><strong>&nbsp;&nbsp;&nbsp; f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong>&nbsp;&nbsp;&nbsp; f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong>&nbsp;&nbsp;&nbsp; f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br> </p><p>&nbsp;&nbsp; ...etc...<br></p><p>4) Retrieve the results as needed:</p><p><strong>&nbsp;&nbsp;&nbsp; r1 = f1()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r2 = f2()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r3 = f3()&nbsp;</strong> </p><p>&nbsp;&nbsp;&nbsp; ...etc...</p><p>&nbsp;To find out how to achieve efficient parallelization with pp please take a look at <a href="http://www.parallelpython.com/content/view/17/31/" title="Parallel Python Implementation Examples">examples</a> </p> <hr><h1 id="QUICKCLUSTERS">&nbsp; Quick start guide, clusters&nbsp; </h1><p><em><strong>On the nodes</strong></em> <br></p><p>1) Start parallel python execution server on all your remote computational nodes:</p><p><strong>&nbsp;&nbsp;&nbsp; node-1&gt; ./ppserver.py </strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-2&gt; ./ppserver.py</strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-3&gt; ./ppserver.py</strong></p><p><em><strong>On the client</strong></em> <br></p><p>2) Import pp module:</p><p><strong>&nbsp;&nbsp;&nbsp; import pp</strong></p><p>3)&nbsp; Create a list of all the nodes in your cluster (computers where you've run ppserver.py) </p><p><strong>&nbsp;&nbsp;&nbsp; ppservers=("node-1", "node-2", "node-3")</strong><br></p><p>4)
 Start pp execution server with the number of workers set 
to&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system
 and list of ppservers to connect with :</p><p><strong>&nbsp;&nbsp;&nbsp; job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>)&nbsp;</strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong>&nbsp;&nbsp;&nbsp; f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong>&nbsp;&nbsp;&nbsp; f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong>&nbsp;&nbsp;&nbsp; f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br> </p><p>&nbsp;&nbsp; ...etc...<br></p><p>6) Retrieve the results as needed:</p><p><strong>&nbsp;&nbsp;&nbsp; r1 = f1()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r2 = f2()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r3 = f3()&nbsp;</strong> </p><p>&nbsp;&nbsp;&nbsp; ...etc...</p><p>&nbsp;To find out how to achieve efficient parallelization with pp please take a look at <a href="http://www.parallelpython.com/content/view/17/31/" title="Parallel Python Implementation Examples">examples</a></p> <hr><h1 id="QUICKCLUSTERSAUTO">&nbsp; Quick start guide, clusters with autodiscovery<br> </h1><p><em><strong>On the nodes</strong></em>&nbsp;</p><p>1) Start parallel python execution server on all your remote computational nodes:</p><p><strong>&nbsp;&nbsp;&nbsp; node-1&gt; ./ppserver.py -a<br> </strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-2&gt; ./ppserver.py -a</strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-3&gt; ./ppserver.py -a<br></strong></p><p><em><strong>On the client</strong></em></p><p>2) Import pp module:</p><p><strong>&nbsp;&nbsp;&nbsp; import pp</strong></p><p>3)&nbsp; Set ppservers list to auto-discovery: </p><p><strong>&nbsp;&nbsp;&nbsp; ppservers=("*",)</strong><br></p><p>4)
 Start pp execution server with the number of workers set 
to&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system
 and list of ppservers to connect with :</p><p><strong>&nbsp;&nbsp;&nbsp; job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>)&nbsp;</strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong>&nbsp;&nbsp;&nbsp; f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong>&nbsp;&nbsp;&nbsp; f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong>&nbsp;&nbsp;&nbsp; f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br> </p><p>&nbsp;&nbsp; ...etc...<br></p><p>6) Retrieve the results as needed:</p><p><strong>&nbsp;&nbsp;&nbsp; r1 = f1()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r2 = f2()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r3 = f3()&nbsp;</strong> </p><p>&nbsp;&nbsp;&nbsp; ...etc...</p><p>&nbsp;To find out how to achieve efficient parallelization with pp please take a look at <a href="http://www.parallelpython.com/content/view/17/31/" title="Parallel Python Implementation Examples">examples</a>&nbsp; </p><hr><h1 id="ADVANCEDCLUSTERS">&nbsp;&nbsp;&nbsp; Advanced guide, clusters&nbsp; </h1> <p><em><strong>On the nodes</strong></em> &nbsp;</p><p>1) Start parallel python execution server on all your remote computational nodes (listen to a given port 35000,<br> and local network interface only, accept only connections which know correct secret):</p><p><strong>&nbsp;&nbsp;&nbsp; node-1&gt; ./ppserver.py -p 35000 -i 192.168.0.101 -s "mysecret"<br></strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-2&gt; ./ppserver.py -p 35000 -i 192.168.0.102</strong><strong> -s "mysecret"</strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-3&gt; ./ppserver.py -p 35000 -i 192.168.0.103</strong><strong> -s "mysecret"</strong></p><p><em><strong>On the client</strong></em> <br></p> <p>2) Import pp module:</p><p><strong>&nbsp;&nbsp;&nbsp; import pp</strong></p><p>3)&nbsp; Create a list of all the nodes in your cluster (computers where you've run ppserver.py) </p><p><strong>&nbsp;&nbsp;&nbsp; ppservers=("node-1:35000", "node-2:</strong><strong>35000</strong><strong>", "node-3:</strong><strong>35000</strong><strong>")</strong><br></p><p>4)
 Start pp execution server with the number of workers set 
to&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system,
 <br>list of ppservers to connect with and secret key to authorize the connection:</p><p><strong>&nbsp;&nbsp;&nbsp; job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>, secret="</strong><strong>mysecret</strong><strong>")&nbsp;</strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong>&nbsp;&nbsp;&nbsp; f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong>&nbsp;&nbsp;&nbsp; f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong>&nbsp;&nbsp;&nbsp; f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br> </p><p>&nbsp;&nbsp; ...etc...<br></p><p>6) Retrieve the results as needed:</p><p><strong>&nbsp;&nbsp;&nbsp; r1 = f1()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r2 = f2()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r3 = f3()&nbsp;</strong> </p><p>&nbsp;&nbsp;&nbsp; ...etc...</p><p>&nbsp;7) Print the execution statistics:<br></p><p><strong>&nbsp;&nbsp;&nbsp; job_server.print_stats()</strong></p><p>To find out how to achieve efficient parallelization with pp please take a look at <a href="http://www.parallelpython.com/content/view/17/31/" title="Parallel Python Implementation Examples">examples</a> </p><hr><h1 id="COMMANDLINE">&nbsp; Command line options, ppserver.py </h1> <pre>Usage: ppserver.py [-hda] [-i interface] [-b broadcast] [-p port] [-w nworkers] [-s secret] [-t seconds]<br> Options:<br> -h                 : this help message<br> -d                 : debug<br> -a                 : enable auto-discovery service<br> -i interface       : interface to listen<br> -b broadcast       : broadcast address for auto-discovery service<br> -p port            : port to listen<br> -w nworkers        : number of workers to start<br> -s secret          : secret for authentication<br> -t seconds         : timeout to exit if no connections with clients exist<br> -k seconds         : socket timeout in seconds <br> -P pid_file          : file to write PID to <br></pre><hr><h1 id="COMMANDLINE">&nbsp; Security and secret key<a name="SECURITY" title="SECURITY"></a></h1><p>&nbsp;Due
 to the security concerns it is highly recommended to run ppserver.py 
with an non-trivial secret key (-s command line argument) which should 
be paired with the matching <em>secret</em> keyword of PP Server class constructor. Since PP 1.5.3 it is possible to set secret key by assigning <strong>pp_secret</strong> variable in the configuration file <strong>.pythonrc.py</strong>
 which should be located in the user home directory (please make this 
file readable and writable only by user). The key set in .pythonrc.py 
could be overridden by command line argument (for ppserver.py) and <em>secret</em> keyword (for PP Server class constructor). </p><p>&nbsp;</p><hr><h1 id="COMMANDLINE">&nbsp; ppserver.py stats and PID file example<br></h1><p>To print job execution statistics for ppserver.py send a SIGUSR1 signal to its main process.<br>For instance on UNIX platform following commands will start a server and print its stats:<br><strong>ppserver.py&nbsp; -P /tmp/ppserver.pid </strong></p><p><strong>kill -s SIGUSR1 `cat /tmp/ppserver.pid`</strong><br></p>

			</td>
		</tr>
				</tbody></table>
		
		<span class="article_seperator">&nbsp;</span>
		
				</div>
	</div>
	<div class="section7">
				<div class="bottom">
					<table class="moduletable" cellpadding="0" cellspacing="0">
				<tbody><tr>
			<td>
				<a href="http://www.nutritionvalue.org/"><img src="ppdoc_files/nv_banner.png" alt="Nutrition facts and analysis" title="Nutrition facts and analysis" style="border:0"></a>
<br>			</td>
		</tr>
		</tbody></table>
				</div>
						<div class="footer">
						
<div align="center">
<font color="gray">Parallel Python Solutions | Parallel Python Forums | Parallel Python Community</font>
</div>
<br>
<div align="center">
<font color="gray">Parallel Python	© 2005 - 2012 Vitalii Vanovschi. All rights reserved</font>
</div>
<script src="ppdoc_files/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-404570-4";
urchinTracker();
</script>
		</div>
				</div>
</div>


</body></html>
<!-- 1356074737 -->